package com.huan.util;

/**
 * @Author 王鹏欢
 * @Date 2022-05-07 16:48
 */
public class PageHelper {
    private int pageSize = 5;
    private int currentPageNo = 0;
    private int recordCount; // jdbc
    private int totalPageCount;

    public int getPageSize()
    {
        return pageSize;
    }

    public void setPageSize(int pageSize)
    {
        this.pageSize = pageSize;
    }

    public int getCurrentPageNo()
    {
        return currentPageNo;
    }

    public void setCurrentPageNo(int currentPageNo)
    {
        this.currentPageNo = currentPageNo;
    }

    public int getRecordCount()
    {
        return recordCount;
    }

    public void setRecordCount(int recordCount)
    {
        this.recordCount = recordCount;
    }

    public int getTotalPageCount()
    {
        return totalPageCount;
    }

    public void setTotalPageCount()
    {
        if (recordCount % pageSize == 0) {
            this.totalPageCount = recordCount / pageSize;
        } else if (recordCount % pageSize > 0) {
            this.totalPageCount = recordCount / pageSize + 1;
        } else {
            this.totalPageCount = 0;
        }
    }
}